<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>评论管理-{$title}-见微-全媒体记者发稿助手</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link href="__PUBLIC__/live/css/base.css" rel="stylesheet">
    <link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css">
    <script src="http://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script src="//cdn.bootcss.com/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js"></script>
    <script src="//cdn.bootcss.com/messenger/1.5.0/js/messenger.min.js"></script>
    <script src="//cdn.bootcss.com/messenger/1.5.0/js/messenger-theme-future.min.js"></script>
    <link href="//cdn.bootcss.com/messenger/1.5.0/css/messenger.min.css" rel="stylesheet">
    <link href="//cdn.bootcss.com/messenger/1.5.0/css/messenger-theme-future.min.css" rel="stylesheet">
    <style>
        html, body {
            background: #fff;
        }

        .search {
            padding-top: 20px;
            padding-left: 15px
        }

        .comment {
            padding: 15px 20px
        }

        .comment td, .comment th {
            text-align: center;
            font-size: 14px
        }

        .flickr {
            text-align: center
        }

        .flickr a, .flickr span {
            display: inline-block;
            border: 1px solid #f0f0f0;
            background: #fff;
            color: #000;
            border-radius: 5px;
            font-size: 16px;
            padding: 0 8px;
            min-width: 40px;
            height: 40px;
            line-height: 40px;
            margin-right: 3px;
        }

        .flickr span {
            background: #ff5356;
            color: #fff;
        }

        .deleted_comment {
            color: #aaa
        }

        #flushComment {
            position: absolute;
            top: 20px;
            right: 51px;
        }
    </style>
</head>
<body>

<include file="Public:header"/>
<button type="button" class="btn btn-sm btn-info" id="flushComment">刷新评论</button>
<div class="break">
    <a href="/Live">主页</a> &gt;  评论管理
</div>
        <div id="commentHolder" style="width:1260px;margin:0 auto">
            <div class="search">
                <form action="{:U('manage')}" method="get" class="form-inline text-center">
                    <div class="form-group">
                        <label>昵称：</label><input type="text" name="nickname" value="{$Think.get.nickname}"
                                                 class="form-control"/>
                    </div>
                    <div class="form-group">
                        <label>内容：</label><input type="text" name="content" value="{$Think.get.content}"
                                                 class="form-control"/>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-warning btn-sm"/>
                        搜索</button>
                    </div>



                    <div class="form-group" style="float: right;margin-right: 20px;">
                        显示过滤：
                        <div class="btn-group" role="group" >
                            <a href="{:U('manage',array('filter'=>0))}" class="btn <?php if(I('filter')==='0'){ echo 'btn-info'; }else{ echo 'btn-default'; } ?> btn-sm">待审核</a>
                            <a href="{:U('manage',array('filter'=>1))}" class="btn <?php if(I('filter')==='1'){ echo 'btn-info'; }else{ echo 'btn-default'; } ?> btn-sm">已审核</a>
                            <a href="{:U('manage')}" class="btn <?php if(!isset($_GET['filter'])){ echo 'btn-info'; }else{ echo 'btn-default'; } ?> btn-sm">显示全部</a>
                        </div>



                    </div>

                </form>
            </div>

            <?php if($commentList) { ?>
            <div class="comment">
                <table class="table table-striped table-hover">
                    <tr>
                        <th width="10%">用户名</th>
                        <th width="21%"  style="text-align: left;">直播标题</th>
                        <th width="45%" style="text-align: left;">评论内容</th>
                        <th width="8%">IP</th>
                        <th width="8%">时间</th>
                        <th width="8%">操作</th>
                    </tr>
                    <volist name='commentList' id="vo">
                        <tr
                        <?php if($vo['is_delete']==1){ ?>class="deleted_comment"<?php }?>>
                        <td>{$vo['username']}</td>
                        <td  style="text-align: left;">{$vo['title']}</td>
                        <td style="text-align: left;">
                            <?php if($vo['is_delete']==1){ ?>
                            [已删除]
                            <?php }?>
                            {$vo['content']}
                        </td>

                        <td>{$vo['ip']}</td>
                        <td>{$vo['time']|date="Y/m/d H:i",###}</td>
                        <td>
                            <?php if($vo['is_delete']==0){ ?>
                            <?php if($vo['is_verify'] == 1) { ?>
                            <a href="javascript:void(0)"  data-id="{$vo['id']}" class="backComment verifyComment title">打回</a>
                            <?php } else { ?>
                            <a href="javascript:void(0)" data-id="{$vo['id']}" class="passComment verifyComment title">通过</a>
                            <?php } ?>
                            |
                            <?php } ?>
                        </td>
                        </tr>
                    </volist>
                </table>
            </div>
            <?php } else { ?>
            暂无评论
            <?php } ?>
            <div class="flickr">{$page}</div>
        </div>



<script>
    $("#flushComment").click(function () {
        location.reload();
    })

    $(".verifyComment").click(function(){
        var _this=this;
        var status;

        if($(_this).hasClass('backComment')){
            status=0;
        }

        if($(_this).hasClass('passComment')){
            status=1;
        }
        var confirmStr=['打回','通过'];

        if(confirm('是否确定'+confirmStr[status]+'此条评论？')){
            $.ajax({
                url:"{:U('verifyCommentById')}?id="+$(_this).data('id')+"&status="+status,
                success:function(data){
                    var msgType="error";
                    if(data.status===1){
                        if(status==0){
                            $(_this).html(confirmStr[Math.abs(status-1)]).removeClass('backComment').addClass('passComment');
                        }else{
                            $(_this).html(confirmStr[Math.abs(status-1)]).removeClass('passComment').addClass('backComment');
                        }
                        msgType="success";
                    }

                    Messenger().post({
                        message: confirmStr[status]+'该评论，'+data.info,
                        type: msgType,
                    })
                }
            });
        }
    })

</script>
</body>
</html>